/*
 * Copyright 2006 Mark Bakker <bakker.mark AT gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.vector.client.impl;

import com.google.gwt.user.client.Element;

/**
 *
 */
public class SVGImpl {

  private static final String HTTP_WWW_W3_ORG_2000_SVG = "http://www.w3.org/2000/svg";

  public Element createCircle() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "circle");
  }

  public Element createEclipse() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "eclipse");
  }

  public Element createLine() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "line");
  }

  public Element createPolyline() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "polyline");
  }

  public Element createRectangle() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "rect");
  }

  public Element createVectorGroup() {
    return createElementNS(HTTP_WWW_W3_ORG_2000_SVG, "svg");
  }

  public void setAttributeNS(Element elem, String attr, String value) {
    setAttributeNS(null, elem, attr, value);
  }

  private native Element createElementNS(String ns, String tag) /*-{
   return $doc.createElementNS(ns, tag);
   }-*/;

  private native void setAttributeNS(String uri, Element elem, String attr,
      String value) /*-{
   elem.setAttributeNS(uri, attr, value);
   }-*/;
}
